home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 98
/
Skunkware 98.iso
/
src
/
mail
/
pine3.96.tar.gz
/
pine3.96.tar
/
pine3.96
/
pine
/
osdep
/
canonicl
< prev
next >
Wrap
Text File
|
1993-07-15
|
772b
|
27 lines
/*----------------------------------------------------------------------
Return canonical form of host name ala c-client (UNIX version).
Args: host -- The host name
Result: Canonical form, or input argument (worst case)
----*/
char *
canonical_name(host)
char *host;
{
struct hostent *hent;
char hostname[MAILTMPLEN];
char tmp[MAILTMPLEN];
extern char *lcase();
/* domain literal is easy */
if (host[0] == '[' && host[(strlen (host))-1] == ']')
return host;
strcpy (hostname,host); /* UNIX requires lowercase */
/* lookup name, return canonical form */
return (hent = gethostbyname (lcase (strcpy (tmp,host)))) ?
hent->h_name : host;
}